<?php


abstract class BaseRelease extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $nombre;


	
	protected $video_id;


	
	protected $subtitulos_coloreados;


	
	protected $codec_video_id;


	
	protected $codec_audio_id;


	
	protected $contenedor_id;


	
	protected $resolucion;


	
	protected $fuente_video_id;


	
	protected $censurado;


	
	protected $recomendado;


	
	protected $insertado;


	
	protected $finalizado = 0;

	
	protected $aVideo;

	
	protected $aCodecVideo;

	
	protected $aCodecAudio;

	
	protected $aContenedor;

	
	protected $aFuenteVideo;

	
	protected $collCapturas;

	
	protected $lastCapturaCriteria = null;

	
	protected $collElinks;

	
	protected $lastElinkCriteria = null;

	
	protected $collIdiomaXReleases;

	
	protected $lastIdiomaXReleaseCriteria = null;

	
	protected $collReleaseXFansubs;

	
	protected $lastReleaseXFansubCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getNombre()
	{

		return $this->nombre;
	}

	
	public function getVideoId()
	{

		return $this->video_id;
	}

	
	public function getSubtitulosColoreados()
	{

		return $this->subtitulos_coloreados;
	}

	
	public function getCodecVideoId()
	{

		return $this->codec_video_id;
	}

	
	public function getCodecAudioId()
	{

		return $this->codec_audio_id;
	}

	
	public function getContenedorId()
	{

		return $this->contenedor_id;
	}

	
	public function getResolucion()
	{

		return $this->resolucion;
	}

	
	public function getFuenteVideoId()
	{

		return $this->fuente_video_id;
	}

	
	public function getCensurado()
	{

		return $this->censurado;
	}

	
	public function getRecomendado()
	{

		return $this->recomendado;
	}

	
	public function getInsertado($format = 'Y-m-d')
	{

		if ($this->insertado === null || $this->insertado === '') {
			return null;
		} elseif (!is_int($this->insertado)) {
						$ts = strtotime($this->insertado);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [insertado] as date/time value: " . var_export($this->insertado, true));
			}
		} else {
			$ts = $this->insertado;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFinalizado()
	{

		return $this->finalizado;
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = ReleasePeer::ID;
		}

	} 
	
	public function setNombre($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->nombre !== $v) {
			$this->nombre = $v;
			$this->modifiedColumns[] = ReleasePeer::NOMBRE;
		}

	} 
	
	public function setVideoId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->video_id !== $v) {
			$this->video_id = $v;
			$this->modifiedColumns[] = ReleasePeer::VIDEO_ID;
		}

		if ($this->aVideo !== null && $this->aVideo->getId() !== $v) {
			$this->aVideo = null;
		}

	} 
	
	public function setSubtitulosColoreados($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->subtitulos_coloreados !== $v) {
			$this->subtitulos_coloreados = $v;
			$this->modifiedColumns[] = ReleasePeer::SUBTITULOS_COLOREADOS;
		}

	} 
	
	public function setCodecVideoId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->codec_video_id !== $v) {
			$this->codec_video_id = $v;
			$this->modifiedColumns[] = ReleasePeer::CODEC_VIDEO_ID;
		}

		if ($this->aCodecVideo !== null && $this->aCodecVideo->getId() !== $v) {
			$this->aCodecVideo = null;
		}

	} 
	
	public function setCodecAudioId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->codec_audio_id !== $v) {
			$this->codec_audio_id = $v;
			$this->modifiedColumns[] = ReleasePeer::CODEC_AUDIO_ID;
		}

		if ($this->aCodecAudio !== null && $this->aCodecAudio->getId() !== $v) {
			$this->aCodecAudio = null;
		}

	} 
	
	public function setContenedorId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->contenedor_id !== $v) {
			$this->contenedor_id = $v;
			$this->modifiedColumns[] = ReleasePeer::CONTENEDOR_ID;
		}

		if ($this->aContenedor !== null && $this->aContenedor->getId() !== $v) {
			$this->aContenedor = null;
		}

	} 
	
	public function setResolucion($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->resolucion !== $v) {
			$this->resolucion = $v;
			$this->modifiedColumns[] = ReleasePeer::RESOLUCION;
		}

	} 
	
	public function setFuenteVideoId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->fuente_video_id !== $v) {
			$this->fuente_video_id = $v;
			$this->modifiedColumns[] = ReleasePeer::FUENTE_VIDEO_ID;
		}

		if ($this->aFuenteVideo !== null && $this->aFuenteVideo->getId() !== $v) {
			$this->aFuenteVideo = null;
		}

	} 
	
	public function setCensurado($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->censurado !== $v) {
			$this->censurado = $v;
			$this->modifiedColumns[] = ReleasePeer::CENSURADO;
		}

	} 
	
	public function setRecomendado($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->recomendado !== $v) {
			$this->recomendado = $v;
			$this->modifiedColumns[] = ReleasePeer::RECOMENDADO;
		}

	} 
	
	public function setInsertado($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [insertado] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->insertado !== $ts) {
			$this->insertado = $ts;
			$this->modifiedColumns[] = ReleasePeer::INSERTADO;
		}

	} 
	
	public function setFinalizado($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->finalizado !== $v || $v === 0) {
			$this->finalizado = $v;
			$this->modifiedColumns[] = ReleasePeer::FINALIZADO;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->nombre = $rs->getString($startcol + 1);

			$this->video_id = $rs->getInt($startcol + 2);

			$this->subtitulos_coloreados = $rs->getInt($startcol + 3);

			$this->codec_video_id = $rs->getInt($startcol + 4);

			$this->codec_audio_id = $rs->getInt($startcol + 5);

			$this->contenedor_id = $rs->getInt($startcol + 6);

			$this->resolucion = $rs->getString($startcol + 7);

			$this->fuente_video_id = $rs->getInt($startcol + 8);

			$this->censurado = $rs->getInt($startcol + 9);

			$this->recomendado = $rs->getInt($startcol + 10);

			$this->insertado = $rs->getDate($startcol + 11, null);

			$this->finalizado = $rs->getInt($startcol + 12);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 13; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Release object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ReleasePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			ReleasePeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ReleasePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aVideo !== null) {
				if ($this->aVideo->isModified()) {
					$affectedRows += $this->aVideo->save($con);
				}
				$this->setVideo($this->aVideo);
			}

			if ($this->aCodecVideo !== null) {
				if ($this->aCodecVideo->isModified()) {
					$affectedRows += $this->aCodecVideo->save($con);
				}
				$this->setCodecVideo($this->aCodecVideo);
			}

			if ($this->aCodecAudio !== null) {
				if ($this->aCodecAudio->isModified()) {
					$affectedRows += $this->aCodecAudio->save($con);
				}
				$this->setCodecAudio($this->aCodecAudio);
			}

			if ($this->aContenedor !== null) {
				if ($this->aContenedor->isModified()) {
					$affectedRows += $this->aContenedor->save($con);
				}
				$this->setContenedor($this->aContenedor);
			}

			if ($this->aFuenteVideo !== null) {
				if ($this->aFuenteVideo->isModified()) {
					$affectedRows += $this->aFuenteVideo->save($con);
				}
				$this->setFuenteVideo($this->aFuenteVideo);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = ReleasePeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += ReleasePeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collCapturas !== null) {
				foreach($this->collCapturas as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collElinks !== null) {
				foreach($this->collElinks as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collIdiomaXReleases !== null) {
				foreach($this->collIdiomaXReleases as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collReleaseXFansubs !== null) {
				foreach($this->collReleaseXFansubs as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aVideo !== null) {
				if (!$this->aVideo->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aVideo->getValidationFailures());
				}
			}

			if ($this->aCodecVideo !== null) {
				if (!$this->aCodecVideo->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aCodecVideo->getValidationFailures());
				}
			}

			if ($this->aCodecAudio !== null) {
				if (!$this->aCodecAudio->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aCodecAudio->getValidationFailures());
				}
			}

			if ($this->aContenedor !== null) {
				if (!$this->aContenedor->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aContenedor->getValidationFailures());
				}
			}

			if ($this->aFuenteVideo !== null) {
				if (!$this->aFuenteVideo->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aFuenteVideo->getValidationFailures());
				}
			}


			if (($retval = ReleasePeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collCapturas !== null) {
					foreach($this->collCapturas as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collElinks !== null) {
					foreach($this->collElinks as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collIdiomaXReleases !== null) {
					foreach($this->collIdiomaXReleases as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collReleaseXFansubs !== null) {
					foreach($this->collReleaseXFansubs as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ReleasePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getNombre();
				break;
			case 2:
				return $this->getVideoId();
				break;
			case 3:
				return $this->getSubtitulosColoreados();
				break;
			case 4:
				return $this->getCodecVideoId();
				break;
			case 5:
				return $this->getCodecAudioId();
				break;
			case 6:
				return $this->getContenedorId();
				break;
			case 7:
				return $this->getResolucion();
				break;
			case 8:
				return $this->getFuenteVideoId();
				break;
			case 9:
				return $this->getCensurado();
				break;
			case 10:
				return $this->getRecomendado();
				break;
			case 11:
				return $this->getInsertado();
				break;
			case 12:
				return $this->getFinalizado();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ReleasePeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getNombre(),
			$keys[2] => $this->getVideoId(),
			$keys[3] => $this->getSubtitulosColoreados(),
			$keys[4] => $this->getCodecVideoId(),
			$keys[5] => $this->getCodecAudioId(),
			$keys[6] => $this->getContenedorId(),
			$keys[7] => $this->getResolucion(),
			$keys[8] => $this->getFuenteVideoId(),
			$keys[9] => $this->getCensurado(),
			$keys[10] => $this->getRecomendado(),
			$keys[11] => $this->getInsertado(),
			$keys[12] => $this->getFinalizado(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ReleasePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setNombre($value);
				break;
			case 2:
				$this->setVideoId($value);
				break;
			case 3:
				$this->setSubtitulosColoreados($value);
				break;
			case 4:
				$this->setCodecVideoId($value);
				break;
			case 5:
				$this->setCodecAudioId($value);
				break;
			case 6:
				$this->setContenedorId($value);
				break;
			case 7:
				$this->setResolucion($value);
				break;
			case 8:
				$this->setFuenteVideoId($value);
				break;
			case 9:
				$this->setCensurado($value);
				break;
			case 10:
				$this->setRecomendado($value);
				break;
			case 11:
				$this->setInsertado($value);
				break;
			case 12:
				$this->setFinalizado($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ReleasePeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setNombre($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setVideoId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setSubtitulosColoreados($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCodecVideoId($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCodecAudioId($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setContenedorId($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setResolucion($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setFuenteVideoId($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setCensurado($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setRecomendado($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setInsertado($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setFinalizado($arr[$keys[12]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(ReleasePeer::DATABASE_NAME);

		if ($this->isColumnModified(ReleasePeer::ID)) $criteria->add(ReleasePeer::ID, $this->id);
		if ($this->isColumnModified(ReleasePeer::NOMBRE)) $criteria->add(ReleasePeer::NOMBRE, $this->nombre);
		if ($this->isColumnModified(ReleasePeer::VIDEO_ID)) $criteria->add(ReleasePeer::VIDEO_ID, $this->video_id);
		if ($this->isColumnModified(ReleasePeer::SUBTITULOS_COLOREADOS)) $criteria->add(ReleasePeer::SUBTITULOS_COLOREADOS, $this->subtitulos_coloreados);
		if ($this->isColumnModified(ReleasePeer::CODEC_VIDEO_ID)) $criteria->add(ReleasePeer::CODEC_VIDEO_ID, $this->codec_video_id);
		if ($this->isColumnModified(ReleasePeer::CODEC_AUDIO_ID)) $criteria->add(ReleasePeer::CODEC_AUDIO_ID, $this->codec_audio_id);
		if ($this->isColumnModified(ReleasePeer::CONTENEDOR_ID)) $criteria->add(ReleasePeer::CONTENEDOR_ID, $this->contenedor_id);
		if ($this->isColumnModified(ReleasePeer::RESOLUCION)) $criteria->add(ReleasePeer::RESOLUCION, $this->resolucion);
		if ($this->isColumnModified(ReleasePeer::FUENTE_VIDEO_ID)) $criteria->add(ReleasePeer::FUENTE_VIDEO_ID, $this->fuente_video_id);
		if ($this->isColumnModified(ReleasePeer::CENSURADO)) $criteria->add(ReleasePeer::CENSURADO, $this->censurado);
		if ($this->isColumnModified(ReleasePeer::RECOMENDADO)) $criteria->add(ReleasePeer::RECOMENDADO, $this->recomendado);
		if ($this->isColumnModified(ReleasePeer::INSERTADO)) $criteria->add(ReleasePeer::INSERTADO, $this->insertado);
		if ($this->isColumnModified(ReleasePeer::FINALIZADO)) $criteria->add(ReleasePeer::FINALIZADO, $this->finalizado);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(ReleasePeer::DATABASE_NAME);

		$criteria->add(ReleasePeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setNombre($this->nombre);

		$copyObj->setVideoId($this->video_id);

		$copyObj->setSubtitulosColoreados($this->subtitulos_coloreados);

		$copyObj->setCodecVideoId($this->codec_video_id);

		$copyObj->setCodecAudioId($this->codec_audio_id);

		$copyObj->setContenedorId($this->contenedor_id);

		$copyObj->setResolucion($this->resolucion);

		$copyObj->setFuenteVideoId($this->fuente_video_id);

		$copyObj->setCensurado($this->censurado);

		$copyObj->setRecomendado($this->recomendado);

		$copyObj->setInsertado($this->insertado);

		$copyObj->setFinalizado($this->finalizado);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getCapturas() as $relObj) {
				$copyObj->addCaptura($relObj->copy($deepCopy));
			}

			foreach($this->getElinks() as $relObj) {
				$copyObj->addElink($relObj->copy($deepCopy));
			}

			foreach($this->getIdiomaXReleases() as $relObj) {
				$copyObj->addIdiomaXRelease($relObj->copy($deepCopy));
			}

			foreach($this->getReleaseXFansubs() as $relObj) {
				$copyObj->addReleaseXFansub($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new ReleasePeer();
		}
		return self::$peer;
	}

	
	public function setVideo($v)
	{


		if ($v === null) {
			$this->setVideoId(NULL);
		} else {
			$this->setVideoId($v->getId());
		}


		$this->aVideo = $v;
	}


	
	public function getVideo($con = null)
	{
		if ($this->aVideo === null && ($this->video_id !== null)) {
						$this->aVideo = VideoPeer::retrieveByPK($this->video_id, $con);

			
		}
		return $this->aVideo;
	}

	
	public function setCodecVideo($v)
	{


		if ($v === null) {
			$this->setCodecVideoId(NULL);
		} else {
			$this->setCodecVideoId($v->getId());
		}


		$this->aCodecVideo = $v;
	}


	
	public function getCodecVideo($con = null)
	{
		if ($this->aCodecVideo === null && ($this->codec_video_id !== null)) {
						$this->aCodecVideo = CodecVideoPeer::retrieveByPK($this->codec_video_id, $con);

			
		}
		return $this->aCodecVideo;
	}

	
	public function setCodecAudio($v)
	{


		if ($v === null) {
			$this->setCodecAudioId(NULL);
		} else {
			$this->setCodecAudioId($v->getId());
		}


		$this->aCodecAudio = $v;
	}


	
	public function getCodecAudio($con = null)
	{
		if ($this->aCodecAudio === null && ($this->codec_audio_id !== null)) {
						$this->aCodecAudio = CodecAudioPeer::retrieveByPK($this->codec_audio_id, $con);

			
		}
		return $this->aCodecAudio;
	}

	
	public function setContenedor($v)
	{


		if ($v === null) {
			$this->setContenedorId(NULL);
		} else {
			$this->setContenedorId($v->getId());
		}


		$this->aContenedor = $v;
	}


	
	public function getContenedor($con = null)
	{
		if ($this->aContenedor === null && ($this->contenedor_id !== null)) {
						$this->aContenedor = ContenedorPeer::retrieveByPK($this->contenedor_id, $con);

			
		}
		return $this->aContenedor;
	}

	
	public function setFuenteVideo($v)
	{


		if ($v === null) {
			$this->setFuenteVideoId(NULL);
		} else {
			$this->setFuenteVideoId($v->getId());
		}


		$this->aFuenteVideo = $v;
	}


	
	public function getFuenteVideo($con = null)
	{
		if ($this->aFuenteVideo === null && ($this->fuente_video_id !== null)) {
						$this->aFuenteVideo = FuenteVideoPeer::retrieveByPK($this->fuente_video_id, $con);

			
		}
		return $this->aFuenteVideo;
	}

	
	public function initCapturas()
	{
		if ($this->collCapturas === null) {
			$this->collCapturas = array();
		}
	}

	
	public function getCapturas($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCapturas === null) {
			if ($this->isNew()) {
			   $this->collCapturas = array();
			} else {

				$criteria->add(CapturaPeer::RELEASE_ID, $this->getId());

				CapturaPeer::addSelectColumns($criteria);
				$this->collCapturas = CapturaPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(CapturaPeer::RELEASE_ID, $this->getId());

				CapturaPeer::addSelectColumns($criteria);
				if (!isset($this->lastCapturaCriteria) || !$this->lastCapturaCriteria->equals($criteria)) {
					$this->collCapturas = CapturaPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCapturaCriteria = $criteria;
		return $this->collCapturas;
	}

	
	public function countCapturas($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CapturaPeer::RELEASE_ID, $this->getId());

		return CapturaPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addCaptura(Captura $l)
	{
		$this->collCapturas[] = $l;
		$l->setRelease($this);
	}

	
	public function initElinks()
	{
		if ($this->collElinks === null) {
			$this->collElinks = array();
		}
	}

	
	public function getElinks($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collElinks === null) {
			if ($this->isNew()) {
			   $this->collElinks = array();
			} else {

				$criteria->add(ElinkPeer::RELEASE_ID, $this->getId());

				ElinkPeer::addSelectColumns($criteria);
				$this->collElinks = ElinkPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ElinkPeer::RELEASE_ID, $this->getId());

				ElinkPeer::addSelectColumns($criteria);
				if (!isset($this->lastElinkCriteria) || !$this->lastElinkCriteria->equals($criteria)) {
					$this->collElinks = ElinkPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastElinkCriteria = $criteria;
		return $this->collElinks;
	}

	
	public function countElinks($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ElinkPeer::RELEASE_ID, $this->getId());

		return ElinkPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addElink(Elink $l)
	{
		$this->collElinks[] = $l;
		$l->setRelease($this);
	}


	
	public function getElinksJoinCategoriaElink($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collElinks === null) {
			if ($this->isNew()) {
				$this->collElinks = array();
			} else {

				$criteria->add(ElinkPeer::RELEASE_ID, $this->getId());

				$this->collElinks = ElinkPeer::doSelectJoinCategoriaElink($criteria, $con);
			}
		} else {
									
			$criteria->add(ElinkPeer::RELEASE_ID, $this->getId());

			if (!isset($this->lastElinkCriteria) || !$this->lastElinkCriteria->equals($criteria)) {
				$this->collElinks = ElinkPeer::doSelectJoinCategoriaElink($criteria, $con);
			}
		}
		$this->lastElinkCriteria = $criteria;

		return $this->collElinks;
	}

	
	public function initIdiomaXReleases()
	{
		if ($this->collIdiomaXReleases === null) {
			$this->collIdiomaXReleases = array();
		}
	}

	
	public function getIdiomaXReleases($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collIdiomaXReleases === null) {
			if ($this->isNew()) {
			   $this->collIdiomaXReleases = array();
			} else {

				$criteria->add(IdiomaXReleasePeer::RELEASE_ID, $this->getId());

				IdiomaXReleasePeer::addSelectColumns($criteria);
				$this->collIdiomaXReleases = IdiomaXReleasePeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(IdiomaXReleasePeer::RELEASE_ID, $this->getId());

				IdiomaXReleasePeer::addSelectColumns($criteria);
				if (!isset($this->lastIdiomaXReleaseCriteria) || !$this->lastIdiomaXReleaseCriteria->equals($criteria)) {
					$this->collIdiomaXReleases = IdiomaXReleasePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastIdiomaXReleaseCriteria = $criteria;
		return $this->collIdiomaXReleases;
	}

	
	public function countIdiomaXReleases($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(IdiomaXReleasePeer::RELEASE_ID, $this->getId());

		return IdiomaXReleasePeer::doCount($criteria, $distinct, $con);
	}

	
	public function addIdiomaXRelease(IdiomaXRelease $l)
	{
		$this->collIdiomaXReleases[] = $l;
		$l->setRelease($this);
	}


	
	public function getIdiomaXReleasesJoinIdioma($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collIdiomaXReleases === null) {
			if ($this->isNew()) {
				$this->collIdiomaXReleases = array();
			} else {

				$criteria->add(IdiomaXReleasePeer::RELEASE_ID, $this->getId());

				$this->collIdiomaXReleases = IdiomaXReleasePeer::doSelectJoinIdioma($criteria, $con);
			}
		} else {
									
			$criteria->add(IdiomaXReleasePeer::RELEASE_ID, $this->getId());

			if (!isset($this->lastIdiomaXReleaseCriteria) || !$this->lastIdiomaXReleaseCriteria->equals($criteria)) {
				$this->collIdiomaXReleases = IdiomaXReleasePeer::doSelectJoinIdioma($criteria, $con);
			}
		}
		$this->lastIdiomaXReleaseCriteria = $criteria;

		return $this->collIdiomaXReleases;
	}

	
	public function initReleaseXFansubs()
	{
		if ($this->collReleaseXFansubs === null) {
			$this->collReleaseXFansubs = array();
		}
	}

	
	public function getReleaseXFansubs($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReleaseXFansubs === null) {
			if ($this->isNew()) {
			   $this->collReleaseXFansubs = array();
			} else {

				$criteria->add(ReleaseXFansubPeer::RELEASE_ID, $this->getId());

				ReleaseXFansubPeer::addSelectColumns($criteria);
				$this->collReleaseXFansubs = ReleaseXFansubPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ReleaseXFansubPeer::RELEASE_ID, $this->getId());

				ReleaseXFansubPeer::addSelectColumns($criteria);
				if (!isset($this->lastReleaseXFansubCriteria) || !$this->lastReleaseXFansubCriteria->equals($criteria)) {
					$this->collReleaseXFansubs = ReleaseXFansubPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastReleaseXFansubCriteria = $criteria;
		return $this->collReleaseXFansubs;
	}

	
	public function countReleaseXFansubs($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ReleaseXFansubPeer::RELEASE_ID, $this->getId());

		return ReleaseXFansubPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addReleaseXFansub(ReleaseXFansub $l)
	{
		$this->collReleaseXFansubs[] = $l;
		$l->setRelease($this);
	}


	
	public function getReleaseXFansubsJoinFansub($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReleaseXFansubs === null) {
			if ($this->isNew()) {
				$this->collReleaseXFansubs = array();
			} else {

				$criteria->add(ReleaseXFansubPeer::RELEASE_ID, $this->getId());

				$this->collReleaseXFansubs = ReleaseXFansubPeer::doSelectJoinFansub($criteria, $con);
			}
		} else {
									
			$criteria->add(ReleaseXFansubPeer::RELEASE_ID, $this->getId());

			if (!isset($this->lastReleaseXFansubCriteria) || !$this->lastReleaseXFansubCriteria->equals($criteria)) {
				$this->collReleaseXFansubs = ReleaseXFansubPeer::doSelectJoinFansub($criteria, $con);
			}
		}
		$this->lastReleaseXFansubCriteria = $criteria;

		return $this->collReleaseXFansubs;
	}

} 